<?php


namespace app\api\validate;


use app\common\model\OrderLog;
use app\lib\exception\ParamException;
use think\Request;
use think\Validate;

class BaseValidate extends Validate
{
    public function goCheck()
    {
        $request = Request::instance();
        $params = $request->param();

        // batch 批量验证 错误msg返回的是数组
        $result = $this->batch()->check($params);
        if(!$result){
            $e = new ParamException([
                'msg'=>$this->error,
            ]);

            OrderLog::record('','请求参数错误',$params);

            throw $e;

        }else{
            return true;
        }

    }
}